package com.onec.service.netty.demo;


import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * ChannelInboundHandler 生命周期的测试
 */

public class InHandlerDemo extends ChannelInboundHandlerAdapter {


  private static final Logger logger = LoggerFactory.getLogger(InHandlerDemo.class);

  @Override
  public void channelRegistered(ChannelHandlerContext ctx) throws Exception {

    logger.info("-----------------:channelRegistered()");
    super.channelRegistered(ctx);
  }

  @Override
  public void channelActive(ChannelHandlerContext ctx) throws Exception {

    logger.info("-----------------:channelActive()");
    super.channelActive(ctx);
  }

  @Override
  public void channelInactive(ChannelHandlerContext ctx) throws Exception {

    logger.info("-----------------:channelInactive()");
    super.channelInactive(ctx);
  }

  @Override
  public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {

    logger.info("-----------------:channelRead()");
    super.channelRead(ctx, msg);
  }

  @Override
  public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {

    logger.info("-----------------:channelReadComplete()");
    super.channelReadComplete(ctx);
  }

  @Override
  public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {

    logger.info("-----------------:userEventTriggered()");
    super.userEventTriggered(ctx, evt);

  }

  @Override
  public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {

    logger.info("-----------------:channelWritabilityChanged()");
    super.channelWritabilityChanged(ctx);
  }

  @Override
  public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {

    logger.info("-----------------:exceptionCaught()");
    super.exceptionCaught(ctx, cause);
  }

  @Override
  public void handlerAdded(ChannelHandlerContext ctx) throws Exception {

    logger.info("-----------------:handlerAdded()");
    super.handlerAdded(ctx);
  }
}
